#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLabel>
#include <QStatusBar>

#include "QrCodeGenerator.h"
#include "barcodebox.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    static MainWindow& getInstance(QWidget* parent = nullptr) {
        static MainWindow instance(parent);
        return instance;
    }

    // 删除拷贝构造和拷贝赋值
    MainWindow(const MainWindow&) = delete;
    MainWindow& operator=(const MainWindow&) = delete;

    ~MainWindow();

private:
     // 私有构造函数
     MainWindow(QWidget *parent = nullptr);

private slots:
    void newDocument();
    void open();
    void save();
    void saveAs();
    void print();
    void selectFont();
    void setColor();
    void setFontBold(bool bold);
    void setFontUnderline(bool underline);
    void setFontItalic(bool italic);
    void about();
    void setStatusBarSize();
    void setRightAlign();
    void setLeftAlign();
    void setCenterAlign();
    void on_actionVisitorGenerate_triggered();

    void on_actionGeneratePoliceInfo_triggered();

    void on_lineEditQRMessage_textChanged(const QString &arg1);

    void on_actionQRcodePrint_triggered();

    void on_actionPoliceInfoPrint_triggered();

    void on_actionVistorPrint_triggered();

    void on_lineEditBarcodeNum_textChanged(const QString &arg1);

    void on_actionBarcodePrinter_triggered();

    void on_actionImportImg_triggered();

public:
    void setTextEdit(const QString& text);

private:
    Ui::MainWindow *ui;
    QString currentFile;
    QLabel* statusLabel;

    QrCodeGenerator m_generator;
    QPixmap m_QRImg;
    BarCodeBox *barCodeBox;//显示条形码区域


};
#endif // MAINWINDOW_H
